package com.hyh.admin.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hyh.ad.common.core.domain.entity.SysLogininfor;
import com.hyh.admin.sys.mapper.SysLoginInforMapper;
import com.hyh.admin.sys.service.ISysLoginInforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Service
public class SysLoginInforServiceImpl implements ISysLoginInforService {
    @Autowired
    private SysLoginInforMapper sysLoginInforMapper;

    @Override
    public int insert(SysLogininfor sysLoginInfor) {
        return sysLoginInforMapper.insert(sysLoginInfor);
    }

    @Override
    public List<SysLogininfor> listAllSelect(SysLogininfor sysLoginInfor) {
        LambdaQueryWrapper<SysLogininfor> queryWrapper = new LambdaQueryWrapper<>(sysLoginInfor);
        queryWrapper.orderByDesc(SysLogininfor::getId);
        return sysLoginInforMapper.selectList(queryWrapper);
    }

    @Override
    public int delete(SysLogininfor sysLoginInfor) {
        return sysLoginInforMapper.deleteById(sysLoginInfor);
    }

    @Override
    public int deleteByIds(Long[] ids) {
        return sysLoginInforMapper.deleteBatchIds(Arrays.asList(ids));
    }

    @Override
    public SysLogininfor detail(SysLogininfor sysLoginInfor) {
        return sysLoginInforMapper.selectById(sysLoginInfor);
    }
}
